package com.jinkeen.dddk

import android.content.IntentFilter
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val intentFilter = IntentFilter()
        intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE")
        val alarm = AlarmReceiver()
        registerReceiver(alarm, intentFilter)

        findViewById<Button>(R.id.close_broadCast).setOnClickListener {
            unregisterReceiver(alarm)
        }
    }
}